<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/



Route::get('/wx',function (Request $request){
    echo $request->echostr;
});
Route::namespace('Api')->prefix('v1')->middleware('cors')->group(function () {





    Route::get('/Print','PrintController@test'); //打印机测试
    Route::get('/appVersion','UserController@appVersion');//app版本信息

    Route::get('/getToken','UserController@getToken')->name('user.getToken'); //根据code获取用户openid
    Route::get('/deliverly','UserController@deliverly');
    Route::get('/getPrintToken','PrintController@getPrintToken'); //打印机
    Route::get('/printTicket','PrintController@printTicket'); //打印机
    Route::get('/getAd','UserController@getAd')->name('user.getAd'); //获取轮播图
    Route::get('/getArticle','UserController@getArticle');  //关于我们
    Route::get('/getOpenid','WechatController@getOpenidFromCode')->name('wechat.openid'); //根据code获取用户openid

    Route::get('/getInfoFromOpenid','UserController@getInfoFromOpenid')->name('user.getInfoFromOpenid'); //根据用户openid获取用户信息


    Route::get('/getGoodList','UserController@getGoodList')->name('users.getGoodList'); //获取商品列表
    Route::get('/getGoodList1','UserController@getGoodList1')->name('users.getGoodList1'); //获取商品列表
    Route::get('/getType','UserController@getType')->name('users.getGoodList'); //获取商品分类

    Route::get('/getSignature','OssController@getSignature');

    Route::any('/notify','WechatPayController@notify')->name('wechatpay.notify'); //支付回调
    Route::middleware('api.refresh')->group(function () {

        Route::post('/getPhone','UserController@getPhone')->name('user.getPhone'); //解密获取用户手机号码

        Route::post('/oss_upload','OssController@upload'); //图片上传

        //保存用户信息
        Route::post('/saveNickname','UserController@saveNickname')->name('users.nickname'); //保存用户微信昵称和头像




        Route::get('/getGoodsInfo','UserController@getGoodsInfo')->name('users.getGoodsInfo'); //获取商品详情

        Route::get('/confirmOrder','UserController@confirmOrder')->name('users.getGoodsInfo'); //获取商品详情


        Route::post('/addOrder','UserController@addOrder')->name('users.addOrder'); //生成订单
        Route::post('/addOrder1','UserController@addOrder1'); //生成订单1

        Route::post('/PayOrder','UserController@PayOrder')->name('users.PayOrder'); //订单列表 去支付
        Route::get('/getOrderDetail','UserController@getOrderDetail'); //订单详情

        Route::get('/getorderList','UserController@getorderList')->name('users.getorderList'); //订单列表
        Route::get('/getorderList1','UserController@getorderList1')->name('users.getorderList1'); //订单列表


    });





});




Route::namespace('Api')->prefix('v1')->middleware('cors','admin.guard')->group(function () {


    Route::post('/adminLogin','AdminController@login')->name('admin.login');  //管理员 登录
    Route::post('/adminWxLogin','AdminController@login1')->name('admin.login1');  //管理员 微信登录

    //微信公众号
    Route::get('/getJsConfig','Wechat1Controller@getJsConfig'); //注入配置参数

    Route::middleware('admin.refresh')->group(function () {
        Route::get('/getInfoFromQr','AdminController@getInfoFromQr');  //根据二维码获取订单信息
        Route::get('/getInfoFromId','AdminController@getInfoFromId');  //根据订单id获取订单信息
        Route::get('/ckeckQrCode','AdminController@ckeckQrCode');  //订单核销
        Route::get('/getAdminOrderList','AdminController@getAdminOrderList');  //订单列表
        Route::post('/ChangePrice','AdminController@ChangePrice');  //修改订单价格


        Route::post('/PrintGoods','AdminController@PrintGoods'); //打印商品标签
        Route::post('/PrintOrder','AdminController@PrintOrder'); //打印订单小票
        Route::post('/changeStock','AdminController@changeStock'); //修改商品库存
        Route::post('/changeGoodsPrice','AdminController@changeGoodsPrice');  //修改商品价格


        Route::get('/getAdminGoodList','AdminController@getAdminGoodList');//商品列表

        Route::post('/addGoods','AdminController@addGoods');  //添加商品
        Route::post('/editGoods','AdminController@editGoods');  //编辑商品
        Route::get('/getGoodsInfo','AdminController@getGoodsInfo');  //商品详情

        Route::get('/getCate','AdminController@getCate');//商品分类
        Route::get('/getColor','AdminController@getColor');//商品颜色
        Route::get('/getMaterial','AdminController@getMaterial');//商品材质
        Route::get('/getSupplier','AdminController@getSupplier');//供应商



    });


});


